package retrofit.boot.hystrix.strategy;

import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.Callable;

/**
 * Created by wulg on 2019/10/22
 * description: HystrixConcurrencyStrategy继承类
 */
@Slf4j
public class RetrofitHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy {

    @Override
    public <T> Callable<T> wrapCallable(final Callable<T> callable) {
        return () -> {
            try {
                return callable.call();
            } catch (Exception e) {
                log.error("RetrofitHttpCommand call failed.", e);
                return null;
            }
        };
    }
}
